import request from '@/utils/request'

var list = ['category', 'goods']

var obj = {}


list.forEach(val => {
  obj[val + 'Index'] = data => ajax(val + '/index', 'get', data)
  obj[val + 'Store'] = data => ajax(val + '/store', 'post', data)
  obj[val + 'Detail'] = data => ajax(val + '/detail', 'get', data)
  obj[val + 'Remove'] = data => ajax(val + '/remove', 'get', data)
})



function ajax(url, type, data) {
  return request({
    url,
    method: type,
    params: data,
    data
  })
}


export default obj




